//
//  UIView+PYExternsion.m
//
//
//  Created by 周培玉 on 15/3/13.
//  Copyright © 2015年 peiyu. All rights reserved.
//

#import "UIView+PYExternsion.h"

@implementation UIView (PYExternsion)

-(void)setViewSize:(CGSize)viewSize
{
    CGRect frame = self.frame;
    frame.size = viewSize;
    self.frame = frame;
}
- (void)setViewWidth:(CGFloat)viewWidth
{
    CGRect frame = self.frame;
    frame.size.width = viewWidth;
    self.frame = frame;
}
- (void)setViewHeight:(CGFloat)viewHeight
{
    CGRect frame = self.frame;
    frame.size.height = viewHeight;
    self.frame = frame;
}
- (void)setViewX:(CGFloat)viewX
{
    CGRect frame = self.frame;
    frame.origin.x = viewX;
    self.frame = frame;
}
- (void)setViewY:(CGFloat)viewY
{
    CGRect frame = self.frame;
    frame.origin.y = viewY;
    self.frame = frame;
}
- (CGSize)viewSize
{
    return self.frame.size;
}
-(CGFloat)viewWidth
{
    return self.frame.size.width;
}
- (CGFloat)viewHeight
{
    return self.frame.size.height;
}
- (CGFloat)viewX
{
    return self.frame.origin.x;
}
- (CGFloat)viewY
{
    return self.frame.origin.y;
}
- (void)setViewCenterX:(CGFloat)viewCenterX
{
    CGPoint center = self.center;
    center.x = viewCenterX;
    self.center = center;
}
- (CGFloat)viewCenterX {
    return self.center.x;
}
- (void)setViewCenterY:(CGFloat)viewCenterY
{
    CGPoint center = self.center;
    center.y = viewCenterY;
    self.center = center;
}
- (CGFloat)viewCenterY
{
    return self.center.y;
}

#pragma mark Edges
- (CGFloat)viewLeft {
	return self.frame.origin.x;
}
- (void)setViewLeft:(CGFloat)viewLeft {
	CGRect frame = self.frame;
	frame.origin.x = viewLeft;
	self.frame = frame;

}

- (CGFloat)viewTop {
	return self.frame.origin.y;
}
- (void)setViewTop:(CGFloat)viewTop {
	CGRect frame = self.frame;
	frame.origin.y = viewTop;
	self.frame = frame;

}

- (CGFloat)viewRight {
	return self.frame.origin.x + self.frame.size.width;
}
- (void)setViewRight:(CGFloat)viewRight {
	CGRect frame = self.frame;
	frame.origin.x = viewRight - frame.size.width;
	self.frame = frame;
}

- (CGFloat)viewBottom {
	return self.frame.origin.y + self.frame.size.height;
}
- (void)setViewBottom:(CGFloat)viewBottom {
	CGRect frame = self.frame;
	frame.origin.y = viewBottom - frame.size.height;
	self.frame = frame;
}






@end
